package com.pulaien.shop.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.pulaien.common.utils.SecurityUtils;
import com.pulaien.system.domain.RakutenInfo;
import com.pulaien.system.domain.dto.RakutenOrderParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pulaien.common.annotation.Log;
import com.pulaien.common.core.controller.BaseController;
import com.pulaien.common.core.domain.AjaxResult;
import com.pulaien.common.enums.BusinessType;
import com.pulaien.system.domain.RakutenOrder;
import com.pulaien.system.service.IRakutenOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.pulaien.common.utils.poi.ExcelUtil;
import com.pulaien.common.core.page.TableDataInfo;

/**
 * 乐天订单信息Controller
 *
 * @author pulaien
 */
@RestController
@RequestMapping("/shop/rakuten/order")
@Api(tags = "乐天订单信息")
public class ShopRakutenOrderController extends BaseController
{
    @Autowired
    private IRakutenOrderService rakutenOrderService;

    /**
     * 查询乐天订单信息列表
     */
    @ApiOperation(value = "乐天订单信息列表")
    @GetMapping("/list")
    public TableDataInfo list(RakutenOrderParam rakutenOrder)
    {
        startPage();
        List<RakutenOrder> list = rakutenOrderService.list(rakutenOrder);
        return getDataTable(list);
    }

    /**
     * 同步最新订单
     */
    @ApiOperation(value = "同步最新订单")
    @GetMapping("/synchronousOrder")
    public AjaxResult synchronousOrder()
    {
        Long userId = SecurityUtils.getUserId();
        return rakutenOrderService.synchronousOrder(userId);
    }

    /**
     * 获取乐天订单信息详情
     */
    /*@ApiOperation(value = "获取乐天订单信息详情")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(rakutenOrderService.selectById(id));
    }*/


}
